<template>
  <div class="search">
    <f-form ref="form" :action="api.bmp" :form-key="this.formItem.materialPackage100Id" >
      <f-form-item label="包商1" type="select" :data="dataArrayTest" name="supplierNum1" dataType="number"    />
      <f-form-item label="包商2" type="select" :data="dataArrayTest" name="supplierNum2" dataType="number"    />
      <f-form-item label="包商3" type="select" :data="dataArrayTest" name="supplierNum3" dataType="number"    />
      <f-form-item label="包商4" type="select" :data="dataArrayTest" name="supplierNum4" dataType="number"    />
      <f-form-item label="包商5" type="select" :data="dataArrayTest" name="supplierNum5" dataType="number"   />
      <f-form-item label="包商6" type="select" :data="dataArrayTest" name="supplierNum6" dataType="number"   />
      <f-form-item label="包商7" type="select" :data="dataArrayTest" name="supplierNum7" dataType="number"    />
      <f-form-item label="包商8" type="select" :data="dataArrayTest" name="supplierNum8" dataType="number"   />
      <f-form-item label="包商9" type="select" :data="dataArrayTest" name="supplierNum9" dataType="number"   />
      <f-form-item label="包商10" type="select" :data="dataArrayTest" name="supplierNum10" dataType="number"  />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'bmpForm',
    props: {},
    data() {
      return {
        dataArrayTest: [{ label: '包商1', value: 1 }, { label: '包商2', value: 2 }, { label: '包商3', value: 3 }, { label: '下拉选需要实现搜索', value: 4 }],
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          materialPackage100Id: '',
          supplierNum1: '',
          supplierNum2: '',
          supplierNum3: '',
          supplierNum4: '',
          supplierNum5: '',
          supplierNum6: '',
          supplierNum7: '',
          supplierNum8: '',
          supplierNum9: '',
          supplierNum10: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.materialPackage100Id) {
          let params={
              materialPackage100Id:data.materialPackage100Id
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
